package com.ssy.lingxi.after.sale.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 维修动作枚举
 * @author ds
 * @date 2021/5/24
 * @version 2.0.0
 */
public enum RepairGoodsActionEnum {
    /**
     * 全部 - 0
     */
    ALL(0, "全部"),
    /**
     * 提交审核
     */
    SUBMIT_VALIFY(1, "提交审核维修申请单"),
    /**
     * 审核请款单(一级)
     */
    EXAMINE_STEP_1(2, "审核维修申请单(一级)"),
    /**
     * 审核请款单(二级)
     */
    EXAMINE_STEP_2(3, "审核维修申请单(二级)"),
    /**
     * 提交请款单
     */
    CONFIRM(4, "确认维修申请单"),

    /**
     * 提交审核
     */
    SUBMIT(5, "提交维修申请单"),
    ;
    private final Integer code;
    private final String message;

    RepairGoodsActionEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getDeclaringClass(), this.getCode());
    }

    public static String getMessage(Integer code) {
        RepairGoodsActionEnum item = Arrays.stream(RepairGoodsActionEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);

        return null != item ? item.getMessage() : "";
    }
}